package dto

import (
	"tuowei.com/app/api/models"
	"tuowei.com/common/dto"
)

type GetLearningListReq struct {
	dto.Pagination `search:"-"`
	Name           string `form:"name" search:"type:contains;column:name;table:sys_learning_list" comment:"课程名称"`
	Status         int    `form:"status" search:"type:exact;column:status;table:sys_learning_list" comment:"学习状态"`
	Subject        string `form:"subject" search:"type:exact;column:subject;table:sys_learning_list"`
	BuyerId        int    `form:"buyer_id" search:"type:exact;column:buyer_id;table:sys_learning_list"`
	SysLearningListOrder
}

type SysLearningListOrder struct {
	UpdatedAtOrder string `search:"type:order;column:updated_at;table:sys_learning_list" form:"updatedAtOrder"`
}

func (m *GetLearningListReq) GetNeedSearch() interface{} {
	return *m
}

type SysLearningListInsertReq struct {
	CourseId int    `json:"course_id" comment:"课程ID"`
	Name     string `json:"name" comment:"课程名称"`
	Subject  string `json:"subject" comment:"科目"`
	Cover    string `json:"cover" comment:"课程封面"`
	BuyerId  int    `json:"buyer_id" comment:"购买学员ID"`
}

func (s SysLearningListInsertReq) Generate(list *models.SysLearningList) {
	list.Subject = s.Name
	list.CourseId = s.CourseId
	list.Name = s.Name
	list.Cover = s.Cover
	list.BuyerId = s.BuyerId
	list.Status = -1
	list.Subject = s.Subject
}

type SysCourseGetById struct {
	CourseId int `uri:"course_id"`
}

type SysLearningListGetById struct {
	id int `uri:"id"`
}

func (r SysLearningListGetById) GetId() interface{} {
	return r.id
}

type ChronographyReq struct {
	TimeType string `json:"time_type" comment:"学习计时 start-开始计时 end-结束计时"`
}

type LearnListVideoStudyReq struct {
	Duration  int `json:"duration" comment:"视频播放进度"`
	ChapterId int `json:"chapter_id" comment:"子章节ID"`
}
